var pageii = null;
$(function () {

    $("#rootDirectory").click(function () {

        if (event.stopPropagation) {
            // 针对 Mozilla 和 Opera
            event.stopPropagation();
        } else if (window.event) {
            // 针对 IE
            window.event.cancelBubble = true;
        }

        var thisSpan = $(this);
        if ($(this).children('ul').css('display') == 'none') {
            $(this).children("a").children("i").removeClass("menu-icon-right");
            $(this).children("a").children("i").addClass("menu-icon-down");
            $(this).siblings().children("a").children("i").addClass("menu-icon-right");
            $(this).children("ul").slideDown("fast");
            $(this).siblings().children("ul").slideUp("fast");
        } else {
            $(this).children("a").children("i").removeClass("menu-icon-down");
            $(this).children("a").children("i").addClass("menu-icon-right");
            $(this).children("ul").slideUp("fast");
        }
    });
    $("#inspectTask").click(function () {

        if (event.stopPropagation) {
            // 针对 Mozilla 和 Opera
            event.stopPropagation();
        } else if (window.event) {
            // 针对 IE
            window.event.cancelBubble = true;
        }
       /* if (!checkMenu('1030100')) {
            return
        }*/
        $("#closedTask").children("a").removeClass("checkLi");
        $("#rectificationTask").children("a").removeClass("checkLi");
        $("#inspectTask").children("a").addClass("checkLi");
        // var projectId=$("#projectId").val();
        $("#datamain").attr("src", "/taskManage/inspectTask");
    });
    $("#rectificationTask").click(function () {

        if (event.stopPropagation) {
            // 针对 Mozilla 和 Opera
            event.stopPropagation();
        } else if (window.event) {
            // 针对 IE
            window.event.cancelBubble = true;
        }

        $("#closedTask").children("a").removeClass("checkLi");
        $("#inspectTask").children("a").removeClass("checkLi");
        $("#rectificationTask").children("a").addClass("checkLi");
        // var projectId=$("#projectId").val();
        $("#datamain").attr("src", "/taskManage/rectificationTask");
    });
    $("#closedTask").click(function () {

        if (event.stopPropagation) {
            // 针对 Mozilla 和 Opera
            event.stopPropagation();
        } else if (window.event) {
            // 针对 IE
            window.event.cancelBubble = true;
        }

        $("#rectificationTask").children("a").removeClass("checkLi");
        $("#inspectTask").children("a").removeClass("checkLi");
        $("#closedTask").children("a").addClass("checkLi");
        $("#datamain").attr("src", "/taskManage/closedLoopTask");
        // var projectId=$("#projectId").val();
        // $("#datamain").attr("src", "/homepage/getProjectDetails?projectId=" + projectId);
    });
    init();
});

function init() {
    // $("#datamain").attr("src", "/homepage/findProjectCountByEpsId");
    $(".content-left-submenu ul li").children("ul").slideDown(10);
    checkLeft();
}

function checkLeft() {
    debugger
    var taskType = $("#taskType").val();
/*    if (taskType == 1) {
        if(!checkMenu('1030100')){
            taskType=2;
        }
    }*/
    if (taskType == "2") {
        $("#closedTask").children("a").removeClass("checkLi");
        $("#inspectTask").children("a").removeClass("checkLi");
        $("#rectificationTask").children("a").addClass("checkLi");
    }
    if (taskType == "3") {
        $("#rectificationTask").children("a").removeClass("checkLi");
        $("#inspectTask").children("a").removeClass("checkLi");
        $("#closedTask").children("a").addClass("checkLi");
    }
}